package com.lagou.protocol;

import com.alibaba.fastjson.JSON;


/**
 * @author ascetic
 * @version 1.0
 * @ClassName JSONSerializer
 * @Description TODO
 * @date 2020-06-26 15:47
 */
public class JSONSerializer implements Serializer {



    @Override
    public byte[] serialize(Object object) {

        return JSON.toJSONBytes(object);
    }



    @Override
    public <T> T deserialize(Class<T> clazz, byte[] bytes) {

        return JSON.parseObject(bytes, clazz);
    }

}